A journaling file system implemented in the operating system of a computing system refers to a file system that logs changes to a journal (mainly, an original log within a designated domain of the file system) before committing the changes to a main file system. In case of a system collision or a power supply problem, the journaling file system can be more rapidly brought back online and thus less likely to be damaged.
Meanwhile, as one of journaling file systems, an extended file system 4 (Ext4 file system) has been developed. The Ext4 file system has been widely used in various environments such as enterprise, desktop and mobile environments.
In general, the Ext4 file system divides the whole storage space where files are stored into multiple block groups in order to efficiently maintain metadata and contents of the files. Herein, each block group has its unique layout including “data block bitmap (one block)”, “inode or index node bitmap (one block)”, “inode table (m blocks)”, and “data block (n blocks)”. The data block bitmap and the inode (or index node) bitmap block in the block group show entries of available inode and data block. Further, the inode table includes consecutive 4 KB inode blocks, and each inode block includes 16 inodes. That is, the default size of an inode is 256 B. Each inode is configured to write metadata of a file and is used when the Ext4 file system accesses a data block to read or update contents of a file.
In this regard, Korean Patent No. 10-0611739 (entitled “Parallel resource allocation and freeing method in journaling file system of multi-processor environment”) discloses a method of allocating and returning a block resource of a disk using metadata divided into multiple allocation groups, including: a transaction starting step of allocating a transaction identifier from a transaction table in response to multiple transaction start requests and initializing an allocation resource list, a return resource list, and a fixed buffer list included in the identifier; a resource allocating step of allocating a resource from a specific allocation group in response to a resource allocation request with respect to the specific allocation group from the transaction and registering an identifier of the allocated resource at the allocation resource list of the transaction table; a resource returning step of registering an identifier of a resource at the return resource list of the transaction table in response to a return request for the specific resource from the transaction and making an actual resource return process wait until the transaction is completed; a transaction completing step of discarding the allocation resource list in response to a transaction complete request from the transaction, returning all of resources included in the return resource list, deallocating all of buffers included in the fixed buffer list and then returning the transaction identifier; and a transaction retracting step of returning all of resources included in the allocation resource list in response to a transaction retract request from the transaction, discarding the return resource list, deallocating all of the buffers included in the fixed buffer list and returning the transaction identifier.
Meanwhile, conventionally, when a file in the Ext4 file system is deleted, the Ext4 file system deletes a corresponding data block in the file system using an unlink( ) system call and reclaims a storage space used by the file. However, in the file system, a flash page relevant to the deleted file continuously remains valid in a flash storage even after the deletion operation. Such a flash page is referred to as a ghost page. The ghost page negatively affects the performance and durability of the flash storage. This is because the ghost page is copied into another flash page during garbage collection of the flash storage. That is, the conventional Ext4 file system executes a discard/trim command only with respect to a data block in the file system, and, thus, unused blocks in a metadata block unnecessarily remain in a storage and results in a decrease in performance and lifetime of the storage. The metadata block of the file system occupies a relatively small portion in a space of the file system, but may cause a high write amplification factor. This is because a flash page mapped in the metadata block of the file system can also become a ghost page.